package cn.ttxs.wq.adapter;

import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import cn.ttxs.wq.R;
import cn.ttxs.wq.entity.MultiMsgEntity;

public class MultiMsgAdapter extends BaseMultiItemQuickAdapter<MultiMsgEntity, BaseViewHolder> {


    //输入框
    public static final int DRAG_BTN_0 = 0;
    public static final int DRAG_BTN_1 = 1;
    public static final int DRAG_BTN_2 = 2;
    public static final int DRAG_BTN_all = 3;

    public MultiMsgAdapter(@Nullable List<MultiMsgEntity> data) {
        super(data);
        addItemType(DRAG_BTN_0, cn.ttxs.lib.R.layout.easy_swipmenu_none);
        addItemType(DRAG_BTN_1, cn.ttxs.lib.R.layout.easy_swipmenu_one);
        addItemType(DRAG_BTN_2, cn.ttxs.lib.R.layout.easy_swipmenu_two);
        addItemType(DRAG_BTN_all, cn.ttxs.lib.R.layout.easy_swipmenu_all);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, MultiMsgEntity multiMsgEntity) {
        baseViewHolder.setText(R.id.tv_content, multiMsgEntity.getContent());
        TextView textView = baseViewHolder.getView(R.id.tv_content);
        switch (multiMsgEntity.getItemType()) {
            case DRAG_BTN_0:
                textView.setText("无左滑"+multiMsgEntity.getContent());
                textView.setTextColor(Color.RED);
                break;
            case DRAG_BTN_1:
                textView.setText("左滑1按钮"+multiMsgEntity.getContent());
                textView.setTextColor(Color.GREEN);
                break;
            case DRAG_BTN_2:
                textView.setText("左滑2按钮"+multiMsgEntity.getContent());
                textView.setTextColor(Color.YELLOW);
                break;
            case DRAG_BTN_all:
                textView.setText("左右滑3按钮"+multiMsgEntity.getContent());
                textView.setTextColor(Color.BLACK);
                break;
        }
    }
}